function TipMsg(msg) {
    top.showTips(msg);
}

String.prototype.isDate = function () {
    var arr = this.match(/^(\d{4})-(\d{2})-(\d{2})$/);
    if (arr == null) {
        arr = this.match(/^(\d{4})(\d{2})(\d{2})$/);
        if (arr == null) return null;
    }
    var dt = new Date(arr[1], arr[2] - 1, arr[3]);
    if (dt.getFullYear() == parseInt(arr[1]) && dt.getMonth() + 1 == parseInt(arr[2], 10) && dt.getDate() == parseInt(arr[3], 10))
        return dt;
};

function SetCookie(cookieName, cookieValue, nDays) {
    var today = new Date();
    var expire = new Date();
    if (nDays == null || nDays == 0) nDays = 1;
    expire.setTime(today.getTime() + 3600000 * 24 * nDays);
    document.cookie = cookieName + "=" + escape(cookieValue) + ";path=/;expires=" + expire.toGMTString();
}

function GetCookie(namex) {
    var cookieString = new String(document.cookie);
    var cookieHeader = namex + "=";
    var beginPosition = cookieString.indexOf(cookieHeader);
    if (beginPosition != -1) {
        cookieString = cookieString.substring(beginPosition + cookieHeader.length);
        if (cookieString.indexOf(";") > -1) {
            cookieString = cookieString.substring(0, cookieString.indexOf(";"));
        }
        return unescape(cookieString);
    }
    return "";
}
